servo3 2.2.0
Loading...
Searching...
No Matches
Servo 3 Click Driver

API for configuring and manipulating Servo 3 Click driver. More...

Topics

 Servo 3 PWM Settings
 Settings for configuration of Servo 3 Click driver.
 Servo 3 MikroBUS Map
 MikroBUS pin mapping of Servo 3 Click driver.

Functions

void servo3_cfg_setup (servo3_cfg_t *cfg)
 Servo 3 configuration object setup function.
err_t servo3_init (servo3_t *ctx, servo3_cfg_t *cfg)
 Servo 3 initialization function.
err_t servo3_set_duty_cycle (servo3_t *ctx, float duty_cycle)
 Servo 3 sets PWM duty cycle.
err_t servo3_pwm_stop (servo3_t *ctx)
 Servo 3 stop PWM module.
err_t servo3_pwm_start (servo3_t *ctx)
 Servo 3 start PWM module.
void servo3_write_control (servo3_t *ctx, uint32_t fc_data, uint8_t bc_data)
 Servo 3 write control function.
void servo3_write_data (servo3_t *ctx, uint8_t *data_in, uint8_t len)
 Servo 3 write data function.
void servo3_set_sclk_pin (servo3_t *ctx, uint8_t state)
 Servo 3 set SCLK pin function.
void servo3_set_sin_pin (servo3_t *ctx, uint8_t state)
 Servo 3 set SIN pin function.
void servo3_set_xlat_pin (servo3_t *ctx, uint8_t state)
 Servo 3 set XLAT pin function.
uint8_t servo3_get_sout_pin (servo3_t *ctx)
 Servo 3 get SOUT pin state function.
err_t servo3_set_channel_pwm (servo3_t *ctx, uint8_t ch_num, uint16_t pwm_out)
 Servo 3 set channel PWM function.
err_t servo3_set_angle (servo3_t *ctx, uint8_t ch_num, uint8_t angle)
 Servo 3 set angle function.
void servo3_update_output (servo3_t *ctx)
 Servo 3 update output function.

Detailed Description

API for configuring and manipulating Servo 3 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ servo3_cfg_setup()

void servo3_cfg_setup ( servo3_cfg_t * cfg)

Servo 3 configuration object setup function.

This function initializes Click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See servo3_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ servo3_get_sout_pin()

uint8_t servo3_get_sout_pin ( servo3_t * ctx)

Servo 3 get SOUT pin state function.

This function returns the logic state of the SOUT (serial output) pin.

Parameters
[in]ctx: Click context object. See servo3_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ servo3_init()

err_t servo3_init ( servo3_t * ctx,
servo3_cfg_t * cfg )

Servo 3 initialization function.

This function initializes all necessary pins and peripherals used for this Click board.

Parameters
[out]ctx: Click context object. See servo3_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See servo3_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ servo3_pwm_start()

err_t servo3_pwm_start ( servo3_t * ctx)

Servo 3 start PWM module.

This function starts the PWM module output.

Parameters
[in]ctx: Click context object. See servo3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ servo3_pwm_stop()

err_t servo3_pwm_stop ( servo3_t * ctx)

Servo 3 stop PWM module.

This function stops the PWM module output.

Parameters
[in]ctx: Click context object. See servo3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ servo3_set_angle()

err_t servo3_set_angle ( servo3_t * ctx,
uint8_t ch_num,
uint8_t angle )

Servo 3 set angle function.

This function sets the servo angle for a specific channel or all channels.

Parameters
[in]ctx: Click context object. See servo3_t object definition for detailed explanation.
[in]ch_num: Channel number (0-15 or all channels).
[in]angle: Servo angle in degrees (0-180).
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ servo3_set_channel_pwm()

err_t servo3_set_channel_pwm ( servo3_t * ctx,
uint8_t ch_num,
uint16_t pwm_out )

Servo 3 set channel PWM function.

This function sets the PWM output for a specific channel or all channels.

Parameters
[in]ctx: Click context object. See servo3_t object definition for detailed explanation.
[in]ch_num: Channel number (0-15 or all channels).
[in]pwm_out: PWM output value.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ servo3_set_duty_cycle()

err_t servo3_set_duty_cycle ( servo3_t * ctx,
float duty_cycle )

Servo 3 sets PWM duty cycle.

This function sets the PWM duty cycle in percentages ( Range[ 0..1 ] ).

Parameters
[in]ctx: Click context object. See servo3_t object definition for detailed explanation.
[in]duty_cycle: PWM duty cycle.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ servo3_set_sclk_pin()

void servo3_set_sclk_pin ( servo3_t * ctx,
uint8_t state )

Servo 3 set SCLK pin function.

This function sets the SCLK (serial clock) pin to the specified logic state.

Parameters
[in]ctx: Click context object. See servo3_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ servo3_set_sin_pin()

void servo3_set_sin_pin ( servo3_t * ctx,
uint8_t state )

Servo 3 set SIN pin function.

This function sets the SIN (serial input) pin to the specified logic state.

Parameters
[in]ctx: Click context object. See servo3_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ servo3_set_xlat_pin()

void servo3_set_xlat_pin ( servo3_t * ctx,
uint8_t state )

Servo 3 set XLAT pin function.

This function sets the XLAT (latch) pin to the specified logic state.

Parameters
[in]ctx: Click context object. See servo3_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ servo3_update_output()

void servo3_update_output ( servo3_t * ctx)

Servo 3 update output function.

This function updates the PWM output values for all channels by writing them to the device.

Parameters
[in]ctx: Click context object. See servo3_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ servo3_write_control()

void servo3_write_control ( servo3_t * ctx,
uint32_t fc_data,
uint8_t bc_data )

Servo 3 write control function.

This function writes control data to the device via the serial interface, updates the internal registers, and starts the PWM to clock out control data.

Parameters
[in]ctx: Click context object. See servo3_t object definition for detailed explanation.
[in]fc_data: 18-bits function control data.
[in]bc_data: 7-bits brightness control data.
Returns
None.
Note
None.

◆ servo3_write_data()

void servo3_write_data ( servo3_t * ctx,
uint8_t * data_in,
uint8_t len )

Servo 3 write data function.

This function writes data to the device via the serial interface, updates the internal registers, and starts the PWM to clock out grayscale data.

Parameters
[in]ctx: Click context object. See servo3_t object definition for detailed explanation.
[in]data_in: Pointer to the data to write.
[in]len: Number of bytes to write.
Returns
None.
Note
None.